"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = require("axios");
const cheerio_1 = require("cheerio");
const CryptoJS = require("crypto-js");
const searchRows = 20;
const host="http://202.63.172.66:5862/api";

async function getTopLists() {
    const url = host+"/apps/topList?platform=qq&pagesize=30&orderid=4&page=1&time=1729900538&token=9973a9dddce402149f3e0e62c7fbc82a&appVersion=2.4.1";

    const html = await axios_1.default.get(url, {
        headers: headers,
    });
    const obj=html.data;
    return obj;

}

async function getTopListDetail(topListItem) {
    const data = await axios_1.default.get(host+"gettoplistdetail.php?id="+topListItem.id);
    return eval('(' + data.data + ')');
}

async function getMediaSource(musicItem, quality) {
    const data = await axios_1.default.get(host+"getMediaSource.php?id="+musicItem.id+"&qu="+quality);

    return{
        url: data.data,
    };
}


async function testGetTopLists() {
    const url = host+"/apps/topList?platform=qq&pagesize=30&orderid=2&page=1&time=2145835633&token=9317fb5c87e831f8a38feaecf309ca13&appVersion=2.4.1";

    const axios_config = {
        headers:{
            "x-Requested-With": "com.itingshu.hearbook",
            "Accept": "application/json",
            "sign": "da0612cde0f233e113f6a2948bddce2e",
            "Fing": "dbfc730bdf8750cd913eda15d42b96ed",
            "Content-Type": "application/x-www-form-urlencoded",
            "user-agent": "Mozilla/5.0 (Linux; Android 14; 23013RK75C Build/UKQ1.230804.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/118.0.0.0 Mobile Safari/537.36 uni-app Html5Plus/1.0 (Immersed/34.285713)",
            "Host": "202.63.172.66:5862"
        }
    };

    const html = await axios_1.default.get(url, axios_config);
    const obj=html.data;
    console.log(obj);
    return obj;
}

module.exports = {
    /** 用来说明插件信息的属性 */
    platform: "我的FM", // 插件名
    version: "1.0.9", // 插件版本号
    hints: {
        importMusicSheet: [
            "我的FM电台，自己收藏",

        ],
    },
    primaryKey: ["id"],
    cacheControl: "no-cache",
    srcUrl: "http://tv.zanlagua.com/cj.js",
    /** 供给软件在合适的时机调用的函数 */

    getTopLists,
    getTopListDetail,
    getMediaSource,
};

console.log(testGetTopLists());